package e.odbo.data.service.base;

import com.openbravo.data.basic.BasicException;
import e.odbo.data.bean.IKeyed;
import e.odbo.data.bean.I_BaseBean;
import e.odbo.data.dsl.query.QBFParameters;

import java.util.List;

public interface I_BaseBeanService<T extends I_BaseBean> extends I_ViewBeanService<T>{

    boolean exist(IKeyed id) throws BasicException;

    int update(T t) throws BasicException;

    int delete(IKeyed t) throws BasicException;

    int insert(T t) throws BasicException;

    int delete(List<IKeyed> objs) throws BasicException;

    int update(List<T> objs) throws BasicException;

    int insert(List<T> objs) throws BasicException;

    int insertOrUpdate(T t) throws BasicException;

    int insertOrUpdate( List<T> objs) throws BasicException;

    int clear() throws BasicException;

    boolean canUpdate();

    boolean canInsert();

    boolean canDelete();

    int updateByField( IKeyed key, String field,  Object newValue) throws BasicException;

    int updateByFields( IKeyed key, String[] fields,  Object[] newValue) throws BasicException;

    int delete(QBFParameters filter) throws BasicException;

    boolean isExistByField(String field, Object value) throws BasicException;

    boolean isExistByFields(String[] fields, Object[] values) throws BasicException;

    boolean isExist(QBFParameters filter)throws BasicException;

    int count(QBFParameters filter) throws BasicException;

    int count()throws BasicException;

    T find(IKeyed id) throws BasicException;

    T find(QBFParameters filter) throws BasicException;
}
